﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Arthus
{
    public partial class korisniciForma : Form
    {
        public korisniciForma()
        {
            InitializeComponent();
        }

        Korisnici.Korisnici korisniciObjekat = null;

        private void buttonRegistruj_Click(object sender, EventArgs e)
        {
            korisniciObjekat = new Korisnici.Korisnici();
            korisniciObjekat.DodajKorisnika(textBoxIme, textBoxLozinka, textBoxPonovljenaLozinka);
        }

        private void korisniciForma_Activated(object sender, EventArgs e)
        {
            korisniciObjekat = new Korisnici.Korisnici();
            korisniciObjekat.PopuniListBox(listBoxKorisnici);
            listBoxKorisnici.SelectedIndex = 0;
        }

        private void buttonZatvori_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void buttonObrisi_Click(object sender, EventArgs e)
        {
            korisniciObjekat = new Korisnici.Korisnici();
            korisniciObjekat.ObrisiKorisnika(listBoxKorisnici.SelectedItem.ToString());
        }

        private void TABKaoENTER(KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                e.SuppressKeyPress = true;
                SelectNextControl(ActiveControl, true, true, true, true);
            }
        }
        private void textBoxIme_KeyDown(object sender, KeyEventArgs e)
        {
            TABKaoENTER(e);
        }
        private void textBoxLozinka_KeyDown(object sender, KeyEventArgs e)
        {
            TABKaoENTER(e);
        }
        private void textBoxPonovljenaLozinka_KeyDown(object sender, KeyEventArgs e)
        {
            TABKaoENTER(e);
        }
    }
}
